package com.andreiamariei.tema6.services;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.andreiamariei.tema6.entities.Actor;

@SuppressWarnings("unchecked")
@Stateless
public class ActorService {

	@PersistenceContext
	private EntityManager em;
	
	public List<Actor> findAll() {
		List<Actor> entities = em.createQuery(
				"select actor from Actor as actor")
				.getResultList();
		return entities;
	}
	
	public Actor find(Long id) {
		Actor actor = em.find(Actor.class, id);
		return actor;
	}
	
}
